import Vue from "vue";
import VueRouter from "vue-router";
import Layout from '@/components/Layout';

Vue.use(VueRouter);

export const routes = [
  {
    path: "/",
    name: "Index",
    hidden: true,
    redirect: { name: "Home" }
  },
  {
    path: "/blogs",
    name: "Blogs",
    hidden: true,
    component: () => import('../views/Blogs.vue')
  },
  {
    path: "/test",
    name: "test",
    hidden: true,
    component: () => import('../views/select.vue')
  },
  {
    path: "/regist",
    name: "regist",
    redirect: '/home/regist',//这里进行重定向到内部在上面声明时也需要在对应的children中补充
    hidden: true,
    component: () => import('../views/regist.vue')
  },
  
  {
    path: "/login",
    name: "Login",
    redirect: '/home/Login',//这里进行重定向到内部
    hidden: true,
    component: () => import('../views/Login.vue')
  },
  
  
  {
    path: '/home',
    name: 'Home',
    redirect: '/home/index',
    component: Layout,
    meta: {
      title: '首页'
    },
    children: [{
      path: 'index',
      name: 'HomeIndex',
      component: () => import('@/views/About'),//首页
      meta: {
        title: '欢迎登录'
      }
    },{
      path: 'select',
      name: 'select',
      hidden: true,
      component: () => import('../views/select.vue'),
      meta: { //搜索页面
        title: '搜索页面'
      }
    },{
      path: 'useradm',
      name: 'useradm',
      hidden: true,
      component: () => import('../views/useradm.vue'),
      meta: { //搜索页面
        title: '用户管理'
      }
    },{
      path: 'useradmedt/:blogId',
      name: 'useradmedt',
      hidden: true,
      component: () => import('../views/useradmedt.vue'),
      meta: { //搜索页面
        title: '用户管理编辑'
      }
    },{
      path: 'regist',
      name: 'regist',
      hidden: true,
      component: () => import('../views/regist.vue'),
      meta: { //就在这里改模板好了
        title: '注册regist'
      }
    },{
      path: 'edituser',
      name: 'edituser',
      hidden: true,
      component: () => import('../views/UserEdit.vue'),
      meta: { //就在这里改模板好了
        title: '修改密码'
      }
    },{
      path: 'tckedit',
      name: 'tckedit',
      hidden: true,
      component: () => import('../views/tckedit.vue'),
      meta: { ///home/tckedit
        title: '编辑票务信息'
      }
    },{
      path: 'admintick',
      name: 'admintick',
      hidden: true,
      component: () => import('../views/admintick.vue'),
      meta: { ///home/tckedit
        title: '管理员编辑票务'
      }
    },{
      path: 'refund',
      name: 'refund',
      hidden: true,
      component: () => import('../views/refund.vue'),
      meta: { ///home/tckedit
        title: '退款管理'
      }
    },{
      path: 'login',
      name: 'login',
      hidden: true,
      component: () => import('../views/Login.vue'),
      meta: { //就在这里改模板好了
        title: '登录Login'
      }
    }]
  },
  {
    path: '/blog',
    name: 'Blog',
    redirect: '/blog/select',
    component: Layout,
    
    meta: {
      title: '查询',
    },
    children: [{
      path: 'blog-list',
      name: 'BlogList',
      component: () => import('../views/Blogs.vue'),
      hidden: true,
      meta: {
        title: '票务列表'
      }
    },
    {
      path: "select",
      name: "select",
      hidden: true,
      component: () => import('../views/select.vue')
    },
    {
      path: 'blog-detail',
      name: 'BlogDetail',
      hidden: true,
      component: () => import('../views/BlogDetail.vue'),
      meta: {
        title: 'blog详情'
      }
    },
    {
      path: 'blog-add',
      name: 'BlogAdd',
      component: () => import('../views/BlogEdit.vue'),
      hidden: true,
      meta: {
        title: '新增票务'
      }
    },
    {
      path: 'address',
      name: 'address',
      component: () => import('../views/address.vue'),
      hidden: true,
      meta: {
        title: '个人地址修改'
      }
    }, {
      path: 'retalk/:blogId',
      name: 'retalk',
      component: () => import('../views/retalk.vue'),
      hidden: true,
      meta: {
        title: '评论测试'
      }
    }, {
      path: 'retalk2/:blogId',
      name: 'retalk2',
      hidden: true,
      component: () => import('../views/retalk.vue'),
      meta: {
        title: '评论测试'
      }
    },{
      path: 'orderlist',
      name: 'orderlist',
      component: () => import('../views/orderlist.vue'),
      hidden: true,
      meta: {
        title: '我的订单'
      }
    },{
      path: 'ticklove',
      name: 'ticklove',
      component: () => import('../views/love.vue'),
      hidden: true,
      meta: {
        title: '我的收藏'
      }
    },
    
    {
      path: 'about',
      name: 'about',
      component: () => import('../views/About.vue'),
      hidden: true,
      meta: {
        title: '关于网页'
      }
    },
    {
      path: 'blog-edit',
      name: 'BlogEdit',
      hidden: true,
      component: () => import('../views/BlogEdit.vue'),
      meta: {
        title: '编辑blog'
      }
    },{
      path: 'edit-add',
      name: 'EditAdd',
      hidden: true,
      component: () => import('../views/editadd.vue'),
      meta: {
        title: '编辑blog'
      }
    },{
      path: 'tickmsg/:blogId',
      name: 'tickmsg',
      hidden: true,
      component: () => import('../views/tkmsg.vue'),
      meta: {
        title: '查看详情信息'
      }
    },{
      path: 'ordermsg/:blogId',
      name: 'ordermsg',
      hidden: true,
      component: () => import('../views/ordermsg.vue'),
      meta: {
        title: '查看订单详情信息'
      }
    }]
  },
  {
    path: "/blog/add",
    name: "BlogAdd",
    hidden: true,
    component: () => import('../views/BlogEdit.vue'),
    meta: {
      requireAuth: true
    }
  },
  {
    path: "/blog/:blogId",
    name: "BlogDetail",
    hidden: true,
    component: () => import('../views/BlogDetail.vue')
  },
  {
    path: "/blog/:blogId/edit",
    name: "BlogEdit",
    hidden: true,
    component: () => import('../views/BlogEdit.vue'),
    meta: {
      requireAuth: true
    }
  },{
    path: "/LoginB",
    name: "loginB",
    hidden: true,
    component: () => import('../views/LoginB.vue'),
    meta: {
      requireAuth: true
    }
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
